export default {
	getters: {
		tabbar(state) {
			return state.tabbar
		},
	},
	state: {
		tabbar: {
			list: [{
					iconPath: "map",
					selectedIconPath: "map-fill",
					text: '配送',
					count: 0,
					isDot: false,
					customIcon: false,
					pagePath: '/pages/distribution/index'
				},
				{
					iconPath: "account",
					selectedIconPath: "account-fill",
					text: '我的',
					count: 0,
					isDot: false,
					customIcon: false,
					pagePath: '/pages/my/index'
				},
			],
			current: 0
		}
	},
	mutations: {
		tabbarchange(state, data) {
			if (typeof data.index === 'number' && data.index < state.tabbar.list.length && data.index > -1) {
				let tabbar = JSON.parse(JSON.stringify(state.tabbar))
				let item = JSON.parse(JSON.stringify(tabbar.list[data.index]))
				item = Object.assign({}, item, data.data)
				tabbar.list[data.index] = item
				state.tabbar = tabbar
			}
		},
	},
	actions: {
		['tabbar.change']({
			commit
		}, data) {
			commit('tabbarchange', data)
		}
	}
}
